package auctionhausen

class Listing {

	String name
	Date endDate
	Float startingPrice
	String description
	Customer winner
	Customer seller
	List bids // Define as List to maintain order added
	Date dateCreated
	Date lastUpdated
	Boolean expired = false

	static hasMany = [bids : Bid]

	static final Integer  MAX_NAME_SIZE = 63
	static final Float MIN_STARTING_PRICE = 0.0F
	static final Integer  MAX_DESCRIPTION_SIZE = 255

	static constraints = {
		name(blank : false, maxSize : MAX_NAME_SIZE)
		endDate(min : new Date())
		startingPrice(min : MIN_STARTING_PRICE)
		description(maxSize : MAX_DESCRIPTION_SIZE, nullable : true, blank : true)
		winner(nullable : true)
	}

	/*
	 * For Testing Purposes.
	 */
	String toString() {
		return name
	}
}
